package com.ry.es.query;

import org.elasticsearch.index.query.QueryBuilder;
import org.elasticsearch.index.query.RangeQueryBuilder;
import org.elasticsearch.index.query.TermQueryBuilder;

/**
 * Created by walker on 17-11-22.
 *
 */
public class RangeQuery extends EsQuery
{
    private String field;
    private Object from;
    private Object to;

    public RangeQuery(String field, Object from, Object to){
        this.field = field;
        this.from = from;
        this.to = to;
    }

    public Object getFrom()
    {
        return from;
    }

    public void setFrom(Object from)
    {
        this.from = from;
    }

    public Object getTo()
    {
        return to;
    }

    public void setTo(Object to)
    {
        this.to = to;
    }

    public String getField()
    {

        return field;
    }

    public void setField(String field)
    {
        this.field = field;
    }

    public QueryBuilder toQuery()
    {
        return new RangeQueryBuilder(field).from(from).to(to);
    }
}
